package org.dreamwork.jasmine2.web;

import org.dreamwork.jasmine2.web.controls.Page;
import org.dreamwork.jasmine2.events.EventException;
import org.dreamwork.util.IDisposable;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;

/**
 * Created by IntelliJ IDEA.
 * User: seth
 * Date: 2009-1-4
 * Time: 17:03:07
 */
public interface IWebControl extends IDisposable {
    void setId (String id);
    String getId ();

    void setClientId (String clientId);
    String getClientId ();

    void setName (String name);
    String getName ();

    void setVisible (boolean visible);
    boolean isVisible ();

    void setEditable (boolean editable);
    boolean isEditable ();

    void setRunAtServer (boolean runAt);
    boolean isRunAtServer ();

    void setAutoPostback (boolean autoPostback);
    boolean isAutoPostback ();

    void setAttribute (String attrName, String arrtValue);
    String getAttribute (String attrName);
    Iterator getAttributeNames ();
    boolean isContainsAttribute (String attrName);

    void setDynamicAttribute (String attrName, String expression);
    String getDynamicAttribute (String arrtName);
    Iterator getDynamicAttributeNames ();
    boolean isContainsDynamicAttribute (String attrName);

    void setStyle (String name, String value);
    String getStyle (String name);
    Iterator getStyleNames ();
    boolean isContainsStyle (String name);

    void setPage (Page page);
    Page getPage ();

    void setInnerText (CharSequence text);
    CharSequence getInnerText ();

    void setInnerHTML (CharSequence html);
    CharSequence getInnerHTML ();

    // life circle
    void init ();

    void render (PrintWriter writer) throws IOException, EventException;

    IWebControl copy ();

    boolean isDataPostbacked ();
    void setDataPostbacked (boolean flag);

    IWebContainer getParent ();
    void setParent (IWebContainer parent);
}